let name = 'tom'

export function fn() {
  console.log(name)
}

/* 
编译后的伪代码
() => {
  let name = 'tom'

  function fn() {
    console.log(name)
  }

  return {
    fn
  }
}
*/


export const a1 = 'abc'
export const a2 = 'abc2'
export default function fn () {}
export default function fn2 () {}
const a3 = 2
const a4 = 5
export {
  a3,
  a4
}

/* 
整个模块永远是一个对象: {}, 任何暴露语法都是向这个对象添加属性/方法
{
  a1: 'abc',
  a2: 'abc2',
  default: function () {},
  a3,
  a4,
}

import {a1, a2, a3, a4} from './test'
import xxx from './test'
import {default as xxx} from './test
import * as test from './test'
*/